<?php
if (sizeof($childs) > 0) {
    foreach ($childs as $m) {
        ?>
        <tr parentid="<?php echo $m['parentid']; ?>"
            class="<?php echo $m['childcounts'] > 0 ? "haschild" : ""; ?> tr_<?php echo $m['module_id']; ?>"
            id="<?php echo $m['module_id']; ?>">
            <td><?php echo $m['seq']; ?></td>
            <td><?php echo $m['childcounts'] > 0 ? "&nbsp;|——" : "&nbsp;|—"; ?>
                <?php echo $m['category']; ?>
            </td>
            <td><?php
                if ($m['ishid'] == 0) {
                    ?>
                    是
                    <?php
                } else {
                    ?>
                    否
                    <?php
                }
                ?></td>
            <td><?php echo $this->getModuleName($m['module']); ?></td>
            <td><?php echo $m['module_id']; ?></td>
            <td><?php echo $m['module'] == 'link' ? $m['url'] : $m['module']; ?></td>
            <td>

                <button type="button" class="btn btn-primary btn-sm"  onclick="showNewAdd(<?php echo $m['module_id']; ?>)">新建</button>
                <button type="button" class="btn btn-primary btn-sm" onclick="showedit(<?php echo $m['module_id']; ?>)">编辑</button>
                <button type="button" class="btn btn-danger btn-sm" data-target="#confirmModal" data-toggle="modal" onclick="del(<?php echo $m['module_id']; ?>)">删除</button>
            </td>
        </tr>
        <?php
        if (sizeof($m['childs']) > 0) {
            foreach ($m['childs'] as $c) {
                ?>
                <tr parentid="<?php echo $c['parentid']; ?>"
                    class="<?php echo $c['childcounts'] > 0 ? "haschild" : ""; ?> tr_<?php echo $c['module_id']; ?>"
                    id="<?php echo $c['module_id']; ?>">
                    <td><input type="text" class="form-control" name="seq" value="<?php echo $c['seq']; ?>"/></td>
                    <td><i class="fa fa-caret-right"></i>
                        <input type="text" class="form-control" value="<?php echo $c['category']; ?>" name="category"/>
                    </td>
                    <td>
                        <?php
                        if ($c['ishid'] == 0) {
                            ?>
                            是
                            <?php
                        } else {
                            ?>
                            否
                            <?php
                        }
                        ?>
                    </td>
                    <td><?php echo $this->getModuleName($c['module']); ?></td>
                    <td><?php echo $m['module_id']; ?></td>
                    <td><?php echo $c['module'] == 'link' ? $c['url'] : $c['module']; ?></td>
                    <td>
                        <button type="button" class="btn btn-primary btn-sm" onclick="showedit(<?php echo $c['module_id']; ?>)">编辑</button>
                        <button type="button" class="btn btn-danger btn-sm"  data-toggle="modal" data-target="#confirmModal" onclick="del(<?php echo $c['module_id']; ?>)">删除</button>
                    </td>
                </tr>
                <?php
            }
        }
    }
}
